home *** CD-ROM | disk | FTP | other *** search
- /* %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
- % Copyright (C) 1994, by WATCOM International Inc. All rights %
- % reserved. No part of this software may be reproduced or %
- % used in any form or by any means - graphic, electronic or %
- % mechanical, including photocopying, recording, taping or %
- % information storage and retrieval systems - except with the %
- % written permission of WATCOM International Inc. %
- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
- */
-
- /*************************************************************************
- *
- * WColor -- Wrapper for the Windows 95 Color object.
- *
- *************************************************************************/
-
- #ifndef _WCOLOR_HPP_INCLUDED
- #define _WCOLOR_HPP_INCLUDED
- #pragma once
-
- #ifndef _WNO_PRAGMA_PUSH
- #pragma pack(push,8);
- #pragma enum int;
- #endif
-
- #ifndef _WOBJECT_HPP_INCLUDED
- # include "wobject.hpp"
- #endif
- #ifndef _WARRAY_HPP_INCLUDED
- # include "warray.hpp"
- #endif
-
- enum WColorValue {
-
- /**********************************************************
- * Special Color Values
- *********************************************************/
-
- WColorInherited = -2,
- WColorRGB = -1,
-
- WColorNull = 0,
- WColorDefault = WColorNull,
-
- /**********************************************************
- * Normal Color Values
- *********************************************************/
-
- WColorBrightRed,
- WColorFirst = WColorBrightRed,
- WColorBrightGreen,
- WColorBrightBlue,
- WColorRed,
- WColorGreen,
- WColorBlue,
- WColorBlack,
- WColorWhite,
- WColorDarkGray,
- WColorLightGray,
- WColorBrightPink,
- WColorPink,
- WColorBrightYellow,
- WColorYellow,
- WColorBrightCyan,
- WColorCyan,
- WColorLast = WColorCyan,
-
- /**********************************************************
- * System Color Values
- *********************************************************/
-
- WColorMenu,
- WColorSystemFirst = WColorMenu,
- WColorMenuText,
- WColorWindow,
- WColorWindowText,
- WColorWindowFrame,
- WColorBtnHighlight,
- WColorBtnHilight = WColorBtnHighlight,
- WColor3DHighlight = WColorBtnHighlight,
- WColor3DHilight = WColorBtnHilight,
- WColorBtnFace,
- WColor3DFace = WColorBtnFace,
- WColorBtnShadow,
- WColor3DShadow = WColorBtnShadow,
- WColorTextBox,
- WColorEditBox = WColorTextBox,
- WColorDialogBackground,
- WColorBackground,
- WColorDesktop = WColorBackground,
- WColorScrollbar,
- WColorGrayText,
- WColorActiveBorder,
- WColorInactiveBorder,
- WColorAppWorkSpace,
- WColorActiveCaption,
- WColorInactiveCaption,
- WColorCaptionText,
- WColorInactiveCaptionText,
- WColorHighlight,
- WColorHighlightText,
- WColorInfoText,
- WColorInfoBack,
- WColor3DDarkShadow,
- WColor3DLight,
- WColorBtnText,
-
- WColorSystemLastPlusOne,
- WColorSystemLast = WColorSystemLastPlusOne - 1,
-
- /**********************************************************
- * Special Color Value
- *********************************************************/
-
- // forces enum to a long
-
- WColorEnd = 66000
-
- };
-
- typedef WULong WRGBValue;
-
- class WCMCLASS WColor : public WObject {
- WDeclareSubclass( WColor, WObject );
-
- public:
-
- /**********************************************************
- * Constructors and Destructors
- *********************************************************/
-
- WColor( WColorValue col=WColorDefault );
- WColor( const WColor & color );
- WColor( WUChar red, WUChar green, WUChar blue );
-
- ~WColor();
-
- WColor & operator=( const WColor & );
-
- // Equality
-
- int operator==( const WColor & color ) const;
- int operator!=( const WColor & color ) const;
-
- /**********************************************************
- * Properties
- *********************************************************/
-
- // ColorValue
-
- WColorValue GetColorValue() const { return _value; }
- WBool SetColorValue( WColorValue value );
-
- // RGB
-
- WBool SetRGB( WRGBValue val );
- WBool SetRGB( WUChar red, WUChar green, WUChar blue );
- WRGBValue GetRGB() const;
-
- // Red
-
- WBool SetRed( WUChar red );
- WUChar GetRed() const;
-
- // Green
-
- WBool SetGreen( WUChar green );
- WUChar GetGreen() const;
-
- // Blue
-
- WBool SetBlue( WUChar blue );
- WUChar GetBlue() const;
-
- /**********************************************************
- * Methods
- *********************************************************/
-
- // Create
-
- WBool Create( WColorValue col=WColorDefault );
- WBool Create( const WColor & color );
- WBool Create( WUChar red, WUChar green, WUChar blue );
-
- // ResetSystemColors
-
- static void ResetSystemColors();
-
- /**********************************************************
- * Data members
- *********************************************************/
-
- private:
- WColorValue _value;
- WRGBValue _rgbValue; // valid only if _value is WColorRGB
- };
-
- extern template WArrayReference<WColor>;
- extern template WArray<WColor>;
- typedef WArray<WColor> WColorArray;
-
- #ifndef _WNO_PRAGMA_PUSH
- #pragma enum pop;
- #pragma pack(pop);
- #endif
-
- #endif // _WCOLOR_HPP_INCLUDED
-